<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>
<body>
    <div id='app'>
        {{msg}}

        <form action="">
            用户名：<input type="text"name="username" id="" v-model.lazy="username" @input="ipt" @change="aa">
            密码：<input type="password" name="pwd" id="" v-model="pwd">
            <input type="submit" value="提交">
        </form>

    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                username:'',
                pwd:''
            },
            methods: {
                ipt(){
                    console.log(1111);
                    
                },
                aa(){
                    if(this.username.length < 6) return alert('请输入大于6位的用户名')
                }
            }
        });
    </script>
</body>
</html>